﻿<?php

require_once "config.php";
$bname=gPost('name');
$baddress=gPost('addr');
$bphone=gPost('phone');
$bweb=gPost('web');
$bemail=gPost('email');
$a = explode(",", $baddress);
$bcountry = trim($a[2]);
$a1 = explode(" ",trim($a[1]));
$bcity=trim($a1[1]);
$bzip=trim($a1[0]);
$baddress=trim($a[0]);
if(strlen($bname)>1){
	$sql="insert into gmaps (bname,baddress,bcity,bzip,bcountry,bphone,bemail,bweb) value ('$bname','$baddress','$bcity','$bzip','$bphone','$bcountry','$bemail','$bweb')";
	mysql_query($sql) or die($sql);
}
echo "OK";

function gPost($gp)
{
	if (isset($_POST[$gp]))
		return $_POST[$gp];
	else
		return "";
}

?>
